﻿namespace TestByWire.Tutorial
{
	#region Using
	using Microsoft.VisualStudio.TestTools.UnitTesting;
	#endregion

	[TestClass]
	public class CallingWithDependency : TestTarget<ClassWithMethodUsingDependency>
	{
		[TestMethod]
		public void Execute_MustReturnTrue_WhenDependencyReturnsTrue()
		{
			Given.That<ILogic>(l => l.DoAction()).Returns(true);

			bool result = When.Calling.Execute(With<ILogic>.Dependency, 10);

			Assert.IsTrue(result);
		}
	}

	public interface ILogic
	{
		bool DoAction();
	}

	public class ClassWithMethodUsingDependency
	{
		public bool Execute(ILogic logic, int otherValue)
		{
			return logic.DoAction();
		}
	}
}
